package com.micro.school.system.controller.student;

import java.util.List;

import com.micro.school.common.core.utils.poi.ExcelUtil;
import com.micro.school.common.core.web.controller.BaseController;
import com.micro.school.common.core.web.domain.AjaxResult;
import com.micro.school.common.core.web.page.TableDataInfo;
import com.micro.school.common.log.annotation.Log;
import com.micro.school.common.log.enums.BusinessType;
import com.micro.school.system.api.domain.vo.StudentPayVos;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.micro.school.system.domain.vo.StudentPayVo;
import com.ruoyi.system.service.IStudentPayService;


/**
 * 【请填写功能名称】Controller
 * 
 * @author rakic
 * @date 2025-08-05
 */
@RestController
@RequestMapping("/pay")
public class StudentPayController extends BaseController
{
    @Autowired
    private IStudentPayService studentPayService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    public TableDataInfo list(StudentPayVo studentPayVo)
    {
        startPage();
        List<StudentPayVo> list = studentPayService.selectStudentPayList(studentPayVo);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StudentPayVo studentPayVo)
    {
        List<StudentPayVo> list = studentPayService.selectStudentPayList(studentPayVo);
        ExcelUtil<StudentPayVo> util = new ExcelUtil<StudentPayVo>(StudentPayVo.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(studentPayService.selectStudentPayById(id));
    }

    @GetMapping(value = "/getAllLog/{studentId}")
    public AjaxResult getAllLog(@PathVariable("studentId") Long studentId)
    {
        return success(studentPayService.getAllLog(studentId));
    }

    /**
     * 新增【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StudentPayVo studentPayVo)
    {
        return toAjax(studentPayService.insertStudentPay(studentPayVo));
    }

    /**
     * 新增【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping("/saveList")
    public AjaxResult saveList(@RequestBody List<StudentPayVos> studentPayVosList)
    {
        return toAjax(studentPayService.insertStudentPayList(studentPayVosList));
    }


    /**
     * 新增【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PostMapping("/updateList")
    public AjaxResult updateList(@RequestBody List<StudentPayVos> studentPayVosList)
    {
        return toAjax(studentPayService.updateStudentPayList(studentPayVosList));
    }

    /**
     * 修改【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StudentPayVo studentPayVo)
    {
        return toAjax(studentPayService.updateStudentPay(studentPayVo));
    }

    /**
     * 删除【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable List<Long> ids)
    {
        return toAjax(studentPayService.deleteStudentPayByIds(ids));
    }


}
